﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="HCFramework.Product.ProductManage.Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register src="../CategoryManage/ChooseProductCategory.ascx" tagname="ChooseProductCategory" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="groupHeader">
        Product management
    </div>
    <div style="padding-bottom: 5px">
        <b>Category:</b> <uc1:ChooseProductCategory ID="ChooseProductCategory1" runat="server" OnlySelectLeafNode="true"/>
        <asp:Button ID="btnFilter" runat="server" Text="Filter" 
            onclick="btnFilter_Click" />
    </div>
    <asp:Panel ID="PanelGrid" runat="server">
        <telerik:RadGrid ID="RadGridMain" runat="server" Skin="Office2007" AutoGenerateColumns="False"
            OnItemCommand="RadGridMain_ItemCommand" 
            OnPreRender="RadGridMain_PreRender" ShowFooter="True"
            AllowPaging="True" AllowFilteringByColumn="true" AllowSorting="True" GridLines="None" 
            AllowMultiRowSelection="True" onitemdatabound="RadGridMain_ItemDataBound">
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
            </ClientSettings>
            <MasterTableView CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Thêm mới" NoMasterRecordsText="No records.">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <CommandItemSettings AddNewRecordText="Thêm mới" />
                <Columns>
                    <telerik:GridClientSelectColumn UniqueName="column1">
                    </telerik:GridClientSelectColumn>
                    <telerik:GridBoundColumn DataField="ProductID" UniqueName="ProductID" HeaderText="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn AllowFiltering="false">
                        <ItemTemplate>
                            <asp:Image ID="ProductImage" Width="40px" Height="40px" runat="server" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="ProductCode" HeaderText="Product Code" UniqueName="ProductCode">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ProductName" HeaderText="Product Name" UniqueName="ProductName">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Quantity" UniqueName="Quantity" AllowFiltering="False">
                        <ItemTemplate>
                            <asp:TextBox ID="txtQuantity" AutoCompleteType="None" Width="100%" runat="server"
                                Text='<%#Eval("Quantity")%>'></asp:TextBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Price" UniqueName="Price" AllowFiltering="False">
                        <ItemTemplate>
                            <asp:TextBox ID="txtPrice" AutoCompleteType="None" Width="100%" runat="server"
                                Text='<%#Eval("Price")%>'></asp:TextBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="OrderDisplay" UniqueName="OrderDisplay" AllowFiltering="False">
                        <ItemTemplate>
                            <asp:TextBox ID="txtOrderDisplay" AutoCompleteType="None" Width="100%" runat="server"
                                Text='<%#Eval("OrderDisplay")%>'></asp:TextBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="IsActive" AllowFiltering="False">
                        <ItemTemplate>
                            <asp:ImageButton ID="ImageButton1" runat="server" CommandName="IsActive" CommandArgument='<%#Eval("ProductID")%>' ImageUrl='<%#Eval("IsActive")%>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridHyperLinkColumn HeaderText="Edit" UniqueName="EditLink" DataNavigateUrlFields="CategoryID,ProductID" DataNavigateUrlFormatString="~/Product/Admin/ProductManage/InsertUpdate.aspx?CategoryID={0}&ProductID={1}" Text="Edit" AllowFiltering="False">
                    </telerik:GridHyperLinkColumn>
                    <telerik:GridHyperLinkColumn HeaderText="Image" UniqueName="ImageLink" DataNavigateUrlFields="ProductID" DataNavigateUrlFormatString="~/Product/Admin/ProductManage/ProductImageManage.aspx?ProductID={0}" Text="Images" AllowFiltering="False">
                    </telerik:GridHyperLinkColumn>
                    <telerik:GridHyperLinkColumn HeaderText="Copy" UniqueName="CopyLink" DataNavigateUrlFields="CategoryID,ProductID" DataNavigateUrlFormatString="~/Product/Admin/ProductManage/InsertUpdate.aspx?CategoryID={0}&CopyProductID={1}" Text="Copy" AllowFiltering="False">
                    </telerik:GridHyperLinkColumn>
                </Columns>
                <CommandItemTemplate>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Image/add.gif" />
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Them" AccessKey="n" TabIndex="1">Insert</asp:LinkButton>
                </CommandItemTemplate>
            </MasterTableView>
        </telerik:RadGrid>
        <div style="padding-top: 10px">
            <asp:LinkButton ID="LinkButtonUpdate" runat="server" CssClass="linkButton" OnClick="LinkButtonUpdate_Click">Update</asp:LinkButton>
            <asp:LinkButton ID="LinkButtonDelete" OnClientClick="return confirm('Are you sure?');"
                runat="server" CssClass="linkButton" OnClick="LinkButtonDelete_Click">Delete</asp:LinkButton>
        </div>
    </asp:Panel>
</asp:Content>
